Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.getAuthorize = function(t, n) {
    var o = getApp().globalData.token;
    return new Promise(function(n, r) {
        "getuserinfo" == t.type && (o ? n() : t.detail.iv ? wx.login({
            success: function(t) {
                var o = t.code;
                o && wx.getUserInfo({
                    success: function(t) {
                        var r = t.iv, a = t.encryptedData, i = (wx.getStorageSync("user_id"), {
                            code: o,
                            iv: r,
                            encryptedData: a,
                            user_id: ""
                        });
                        (0, e.getAuth)(i).then(function(e) {
                            wx.setStorageSync("token", e.d.token), getApp().globalData.token = e.d.token, getApp().text("授权成功"), 
                            n(e);
                        });
                    }
                });
            }
        }) : (getApp().error("授权失败"), r("授权失败")));
    });
};

var e = require("../api/api");